package com.xiaowen.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaowen.user.entity.User;
import com.xiaowen.user.mapper.UserMapper;
import com.xiaowen.user.service.UserService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yf-wenhao
 * @since 2024-09-18
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {



    @Override
    public User findByPhone(String phoneNumber, String orgName) {
        User user = new User();
        user.setPhoneNumber(phoneNumber);
        user.setOrgName(orgName);
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(user);
        return baseMapper.selectOne(queryWrapper);
    }

    @Override
    public User findByPhone(String phoneNumber) {
        User user = new User();
        user.setPhoneNumber(phoneNumber);
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(user);
        return baseMapper.selectOne(queryWrapper);
    }
}
